let text = require('../../../../common/util/text.js')
Page({

  /**
   * 页面的初始数据
   */
  data: {
    week:0,
    treatment_item_id:0,
    action_id:'',
    info:{},
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    let that =this;
    that.setData({
      action_id:options.id, 
      name:options.name
    })
    that.xInit(0,0,options.id)
  },
 
  onShow() {
    let that =this;
    wx.setNavigationBarTitle({
      title: that.data.name,
    })
  },
  xInit:function(week,treatment_item_id,action_id){
    let that =this;
    // 单个动作详情
    let _dataObj = {
      week: week,
      treatment_item_id: treatment_item_id,//任务_id
      action_id: action_id// 动作_id
    }
    wx.cloud.callFunction({
      name: 'digital_therapy',
      data: {
        action: "get_action_info",
        dataObj: _dataObj
      }
    }).then(res => {
      
      res.result.explain = text.text(res.result.explain)
      that.setData({
        info:res.result,
      })
    })
  },
  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})